Skip to content

feat: introduce all-one-one (auth vs noauth) multi-stage build - #821

Merged
kodiakhq[bot] merged 21 commits into
v2from
warren/revisit-built-tags
May 19, 2025
Merged

kodiakhq[bot] merged 21 commits into
v2from
warren/revisit-built-tags

Conversation

@wrn14897

@wrn14897 wrn14897 commented May 16, 2025 •

Copy link
Copy Markdown
Contributor
  1. Merge 'fullstack' and 'local' (auth + noauth) builds into a single Dockerfile
  2. Introduce 'all-in-one-auth' and 'all-in-one-noauth' build stages
  3. Lock IS_LOCAL_APP_MODE env var
  4. Fix bug in ctrl-c exit with docker run
  5. Enable alerts in local mode (no-auth)
  6. Build common-utils on the fly (no longer needing pulling pkg from npm)

Ref: HDX-1709
Ref: HDX-1713
Ref: HDX-1254
Ref: HDX-1729

To match v2 product definition, we are going to release three images:

  • hyperdx/hyperdx (--target=prod): app only without any other deps (clickhouse, otelcol, mongodb), used in default compose + helm deployment
  • hyperdx/hyperdx-all-in-one (--target=all-in-one-auth): all-in-one build + auth
  • hyperdx/hyperdx-local (--target=all-in-one-noauth): all-in-one build + no-auth

Production impacts:

  • hyperdx/hyperdx: none
  • hyperdx/hyperdx-all-in-one: new
  • hyperdx/hyperdx-local: add server components (alerts, saved searches, dashboards)

@changeset-bot

changeset-bot Bot commented May 16, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f04669b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/common-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented May 16, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperdx-v2-oss-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 19, 2025 10:35pm

Comment thread docker/hyperdx/build.sh
@@ -0,0 +1,11 @@
#!/bin/bash
# Meant to be run from the root of the repo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could harden this bash script to always execute from the repo root directory using git and pushd:

# move to the repo base and remember the current directory
pushd $(git rev-parse --show-toplevel) > /de/null

# On exit, call popd to restore the prior working directory.
trap "popd > /dev/null" EXIT

# do work knowing the cwd is the repo base directory
docker build --squash ......

Probably not critical but provides a nicer user experience.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious why this is a shell script but the other docker build commands are in the Makefile. Putting it into the Makefile keeps the commands in a single place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. this guy is just for local testing. I can move it to Makefile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will cleanup the Makefile later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

historical context is that I'm not a huge fan of make - its ergonomics are pretty poor as a command line runner as it's meant to be a build tool, at the time we settled on commands can be bash files that can be called in from make or from npm scripts which is why I wrote this in a script for the initial version of local mode

Comment thread docker/hyperdx/Dockerfile Outdated
# Set up App (copy from prod stage)
COPY --from=prod /app/api /app/api
COPY --from=prod /app/app /app/app
COPY --from=hyperdx ./entry.local.sh /etc/local/entry.base.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see, this is the only place that copies a source file into /etc/local/entry.base.sh within the docker container. Why not just name the source file /entry.base.sh to make it easier to follow the flow.

Right now the auth/noauth entry point scripts call something named entry.base.sh and it becomes another step to search and figure out that this file was actually a renamed docker/hyperdx/entry.local.sh version.

@wrn14897 wrn14897 May 19, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating this name. The reason behind entry.local.sh is that it's used for 'local mode', which spins up additional services compared to entry.prod.sh. Maybe entry.local.base.sh would be a better name?

Comment thread docker/hyperdx/Dockerfile

# all-in-one no auth ############################################################################################
FROM all-in-one-base AS all-in-one-noauth
COPY --from=hyperdx ./entry.local.noauth.sh /etc/local/entry.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auth/noauth local files only set a single, environment variable. Could we just use the ENV command here to set the value and avoid additional shell script files?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point is to prevent users from overriding the environment variable to potentially disable auth

@kodiakhq
kodiakhq Bot merged commit e7262d1 into v2 May 19, 2025
@kodiakhq
kodiakhq Bot deleted the warren/revisit-built-tags branch May 19, 2025 22:35
knudtty pushed a commit that referenced this pull request Apr 16, 2026
1. Merge 'fullstack' and 'local' (auth + noauth) builds into a single Dockerfile
2. Introduce 'all-in-one-auth' and 'all-in-one-noauth' build stages
3. Lock `IS_LOCAL_APP_MODE` env var
4. Fix bug in ctrl-c exit with docker run
5. Enable alerts in local mode (no-auth)
6. Build `common-utils` on the fly (no longer needing pulling pkg from npm)

Ref: HDX-1709
Ref: HDX-1713
Ref: HDX-1254
Ref: HDX-1729

To match v2 product definition, we are going to release three images:
- hyperdx/hyperdx (--target=prod): app only without any other deps (clickhouse, otelcol, mongodb), used in default compose + helm deployment
- hyperdx/hyperdx-all-in-one (--target=all-in-one-auth): all-in-one build + auth
- hyperdx/hyperdx-local (--target=all-in-one-noauth): all-in-one build + no-auth

Production impacts:
- hyperdx/hyperdx: none
- hyperdx/hyperdx-all-in-one: new
- hyperdx/hyperdx-local: add server components (alerts, saved searches, dashboards)

This branch was successfully deployed

1 active deployment
Preview — f04669b0 Deployed May 19, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants